﻿clickSearch = function (event) {
    event.preventDefault();
    $('#search-user-btn').unbind('click');
    $('#search-user-btn').prop('disabled', 'disabled');
    $('#div-load').append('<div class="loading col-md-offset-2 col-sm-offset-2 saim-sm-2 saim-md-2 saim-md-2" style="width:100%;"></div>');
    var url = $(this).data('url');
    $('#user-panel').load(url, { RPE: $('#user-id').val(), Name: $('#user-name').val() }, function () {
        $('#div-load').find('div.loading').remove();
        $("#search-user-btn").removeAttr("disabled");
        $('#search-user-btn').bind('click', clickSearch);
    });
}

$(document).ready(function () {
    $('#search-user-btn').bind('click', clickSearch);

    $('.form-control').bind('keyup', function (e) {
        if (e.keyCode == 13) {
            $('#search-user-btn').click();
        }
    });
});
